<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        .login-box {
            width: 300px;
            padding: 20px;
            background-color: #f9f9f9;
            border: 1px solid #ddd;
            border-radius: 5px;
            margin: 50px auto;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            position: relative;
            /* 添加此属性以便定位关闭按钮 */
        }

        .close-btn {
            position: absolute;
            top: 10px;
            right: 10px;
            cursor: pointer;
            font-size: 20px;
            color: #999;
        }

        .close-btn:hover {
            color: red;
        }

        .login-box input[type="text"],
        .login-box input[type="password"] {
            width: 90%;
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ddd;
            border-radius: 3px;
        }

        .login-box button {
            width: 100%;
            padding: 10px;
            border: none;
            background-color: #007BFF;
            color: #fff;
            border-radius: 3px;
            cursor: pointer;
        }

        /* 注册表单样式 */
        .register-box {
            display: none;
            /* 初始隐藏 */
            width: 300px;
            padding: 20px;
            background-color: #f9f9f9;
            border: 1px solid #ddd;
            border-radius: 5px;
            margin: 50px auto;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
            position: relative;
        }

        .register-box input[type="text"],
        .register-box input[type="email"],
        .register-box input[type="password"] {
            width: 90%;
            padding: 10px;
            margin-bottom: 10px;
            border: 1px solid #ddd;
            border-radius: 3px;
        }

        .register-box button {
            width: 100%;
            padding: 10px;
            border: none;
            background-color: #007BFF;
            color: #fff;
            border-radius: 3px;
            cursor: pointer;
        }
    </style>


    <script>
        function showRegisterBox() {
            const loginBox = document.querySelector('.login-box');
            const registerBox = document.querySelector('.register-box');

            loginBox.style.display = 'none';
            registerBox.style.display = 'block';
        }

        function showLoginBox() {
            const loginBox = document.querySelector('.login-box');
            const registerBox = document.querySelector('.register-box');

            loginBox.style.display = 'block';
            registerBox.style.display = 'none';
        }

        function closeLoginOrRegisterBox() {
            const loginBox = document.querySelector('.login-box');
            const registerBox = document.querySelector('.register-box');

            if (loginBox.style.display === 'none') {
                registerBox.style.display = 'none';
            } else {
                loginBox.style.display = 'none';
            }
        }
    </script>


    <link rel="stylesheet" href="styles.css">
    <title>美女聚集</title>
</head>










<body>

<!--  -->
<div class="emoji-wrapper">
    &#x1F60D;
</div>

    <!-- 搜索框 -->
    <div class="search-bar">
        <form action="#">
            <input type="text" placeholder="搜索...">
            <button type="submit">搜索</button>
        </form>
    </div>
    <!-- 顶部导航 -->
    <header>
        <nav class="top-navigation">
            <ul>
                <li><a href="#">通知</a></li>
                <li><a href="#">私信</a></li>
                <div class="dropdown">
                    <button class="dropbtn" id="submitBtn">投稿</button>
                    <div class="dropdown-content" id="myDropdown">
                        <a href="#">发布视频</a>
                        <a href="#">视频管理</a>
                        <a href="#">创作中心</a>
                    </div>
                </div>
                <button id="toggleAuthBox" onclick="showLoginBox()">登录/注册</button>
            </ul>
        </nav>
    </header>

    <script>
        document.getElementById("submitBtn").addEventListener("click", function (event) {
            event.preventDefault(); // 阻止按钮的默认跳转行为
            document.getElementById("myDropdown").classList.add("show"); // 显示下拉菜单
            // 在这里手动执行跳转操作
            window.location.href = 'https://www.baidu.com'; // 请替换为你实际想要跳转的URL
        });

        // 保持之前用于关闭下拉菜单的点击监听
        window.onclick = function (event) {
            if (!event.target.matches('.dropbtn') && !event.target.closest('.dropdown-content')) {
                var dropdowns = document.getElementsByClassName("dropdown-content");
                for (var i = 0; i < dropdowns.length; i++) {
                    var openDropdown = dropdowns[i];
                    if (openDropdown.classList.contains('show')) {
                        openDropdown.classList.remove('show');
                    }
                }
            }
        }
    </script>

    <!-- 侧栏导航 -->
    <aside class="sidebar-navigation">
        <ul>
            <li><a href="#">产品1</a></li>
            <li><a href="#">产品2</a></li>
            <li><a href="#">产品3</a></li>
            <li><a href="#">常见问题</a></li>
        </ul>
    </aside>

    <!-- 主内容区域 -->
    <main>
        <h1>欢迎来到我们的网站</h1>
        <p>这里是主要内容...</p>
    </main>


    <!-- 登录表单 -->
    <div class="login-box">
        <span class="close-btn" onclick="closeLoginOrRegisterBox()">×</span>
        <h2>登录</h2>
        <form>
            <input type="text" placeholder="用户名" required>
            <input type="password" placeholder="密码" required>
            <button type="submit">登录</button>
            <br><br>
            <a href="#" onclick="showRegisterBox(); return false;">没有账号？去注册</a>
        </form>
    </div>

    <!-- 注册表单 -->
    <div class="register-box" style="display: none;">
        <span class="close-btn" onclick="closeLoginOrRegisterBox()">×</span>
        <h2>注册</h2>
        <form>
            <input type="text" placeholder="用户名" required>
            <input type="email" placeholder="邮箱" required>
            <input type="password" placeholder="密码" required>
            <button type="submit">注册</button>
            <br><br>
            <a href="#" onclick="showLoginBox(); return false;">已有账号？去登录</a>
        </form>
    </div>



    <script src="scripts.js"></script>

